﻿using Microsoft.AspNetCore.Mvc;
using Zhp.Api.Attributes;
using Zhp.IService.Monitor;
using Zhp.Model.Common;
using Zhp.Model.Monitor;

namespace Zhp.Api.Controllers.Monitor
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiGroup(GroupName = ApiGroupEnum.Monitor)]
    [SeedMenu(MenuGroup = ApiGroupEnum.Monitor, Name = "异常日志", Order = 2, RouterName = "exceptionLog", WebFilePath = "monitor/exceptionLog/index", Icon = "exception")]

    public class ExceptionLogController : ControllerBase
    {
        protected readonly IExceptionLogService _exceptionLogSvc;
        public ExceptionLogController(IExceptionLogService exceptionLogSvc)
        {
            _exceptionLogSvc = exceptionLogSvc;
        }

        [NotAuditLog]
        [SeedList("异常日志列表", "异常日志", ApiGroupEnum.Monitor)]
        [HttpPost]
        public async Task<PageRet<ExceptionLogModel>> Query(ExceptionLogSearch search)
        {
            var list = await _exceptionLogSvc.Query(search);

            return new PageRet<ExceptionLogModel>
            {
                DataList = list,
                TotalCount = search.TotalCount,
            };
        }
    }
}
